use std::env;
use std::fs;

mod bytecode;
mod lex;
mod parse;
mod value;
mod vm;

fn main() {
    let args = env::args().collect::<Vec<String>>();
    if args.len() != 2 {
        println!("Usage: {} script", args[0]);
        return;
    }

    let lua_file = fs::File::open(args[1].to_string()).unwrap();

    let proto = parse::load(lua_file);

    vm::ExeState::new().execute(&proto);
}
